home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8404.arc / TIMETEST.ASM < prev    next >
Assembly Source File  |  1986-01-18  |  1KB  |  69 lines

  1.     title    TIMETEST -- Simple execution time test routine.
  2.     page    60,120
  3.  
  4.     name    TIMETEST
  5.  
  6. comment |
  7.  
  8. TIMETEST -- Simple execution time test routine.
  9.  
  10. Copyright: None.
  11.  
  12. This routine spins in a loop for a while to provide a comparison of actual
  13. versus calculated execution time.
  14.  
  15. Environment: DOS 1.1 or 2.0, segment name CODE, byte aligned.
  16.  
  17. Calling requirements: COM routine.
  18.  
  19. Effects and results: Some processor time burned up.
  20.  
  21. Return conditions: None.
  22.  
  23. Assumptions: None.
  24.  
  25. Limitations: None.
  26.  
  27. Build requirements: COM routine.
  28.  
  29. Program derived from: None.
  30.  
  31. Original code by: Tom Puckett, October 1983.
  32.  
  33. Modifications by: None.
  34.  
  35. |
  36.     page
  37.  
  38. code    segment    public byte
  39.     assume    cs:code
  40.  
  41.     org    100h            ; PSP space
  42.  
  43.     public    TIMETEST
  44. TIMETEST    proc    near
  45.  
  46.     xor    cx,cx            ; 65536 times
  47.     mov    dx,50
  48.  
  49. loop:
  50.     rol     ax,1            ; 2 clocks, two bytes, should drain
  51.     rol     ax,1            ; 2  the prefetch queue....
  52.     rol     ax,1            ; 2
  53.     rol     ax,1            ; 2
  54.     rol     ax,1            ; 2
  55.     rol     ax,1            ; 2
  56.     loop    loop            ; 17
  57.                     ;    = 29 clocks, 6.09 microseconds
  58.  
  59.     dec    dx            ; times 65536 gives .399 seconds
  60.     jnz    loop            ; times 50 gives 20 seconds
  61.  
  62.     ret                ; measured time is about 50 seconds!
  63.  
  64. TIMETEST endp
  65.  
  66. code    ends            ; end code segment
  67.  
  68.      end    TIMETEST    ; end module
  69.